# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=dbus-glib

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.102
pkgrel=1
arch=('any')
pkgdesc="D-Bus Message Bus System (mingw-w64)"
depends=("${MINGW_PACKAGE_PREFIX}-glib2" "${MINGW_PACKAGE_PREFIX}-dbus" "${MINGW_PACKAGE_PREFIX}-expat")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "${MINGW_PACKAGE_PREFIX}-pkg-config" )
options=('strip' 'staticlibs')
license=("BSD")
url="http://www.freedesktop.org/wiki/Software/dbus"
source=("http://dbus.freedesktop.org/releases/${_realname}/${_realname}-${pkgver}.tar.gz"{,.asc})
md5sums=('f76b8558fd575d0106c3a556eaa49184'
         'SKIP')

prepare() {
  cd "${srcdir}"/${_realname}-${pkgver}
}

build() {
  rm -rf build-${MINGW_CHOST}
  mkdir -p build-${MINGW_CHOST}
  cd build-${MINGW_CHOST}

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --build=${MINGW_CHOST} \
    --enable-shared \
    --disable-static
  make
}

package() {
  cd "$srcdir/build-${MINGW_CHOST}"
  make DESTDIR=$pkgdir install
  find "${pkgdir}${MINGW_PREFIX}" -name '*.def' -o -name '*.exp' | xargs -rtl1 rm
  #rm -rf "${pkgdir}${MINGW_PREFIX}"/share/man
  #rm -rf "${pkgdir}${MINGW_PREFIX}"/{etc,var,libexec,share}
}
